﻿using System;
using System.Xml.Linq;
using Autodesk.Revit.DB;

namespace YArchitech.Revit
{
	public struct SystemInfo
	{
		public MEPSystemClassification SystemClass { get; set; }

		public string Name { get; set; }

		public SystemInfo(Element elem)
		{
			this = default(SystemInfo);
			this.SystemClass = elem.GetSystemClass();
			this.Name = elem.GetSystemName();
		}

		public SystemInfo(Connector connector)
		{
			this = default(SystemInfo);
			this.SystemClass = connector.GetSystemClass();
			this.Name = connector.GetSystemName();
		}

		public void Save(XElement xe)
		{
			xe.SetAttributeValue("SystemName", this.Name);
			xe.SetAttributeValue("SystemClass", this.SystemClass);
		}
	}
}
